<?php
// 订单自主查询系统 - 管理员信息展示页面
// 版权所有 © 2025 慕念科技. 保留所有权利.

// 启动会话
session_start();

// 检查是否有权访问此页面
if (!isset($_SESSION['admin_info'])) {
    // 如果没有管理员信息会话，跳转到首页
    header('Location: ../index.php');
    exit;
}

// 获取管理员信息
$adminInfo = $_SESSION['admin_info'];

// 移除admin_info会话，确保只显示一次
unset($_SESSION['admin_info']);
session_write_close();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>安装完成 - 管理员信息</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        
        .container {
            background-color: white;
            border-radius: 15px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
            padding: 40px;
            max-width: 500px;
            width: 100%;
            text-align: center;
            animation: fadeIn 0.5s ease;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .logo {
            margin-bottom: 30px;
        }
        
        .logo i {
            font-size: 60px;
            color: #667eea;
        }
        
        h1 {
            color: #2c3e50;
            margin-bottom: 20px;
            font-size: 28px;
        }
        
        .success-message {
            background-color: #d4edda;
            color: #155724;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 30px;
            border: 1px solid #c3e6cb;
        }
        
        .admin-avatar {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            margin: 0 auto 20px;
            border: 4px solid #e9ecef;
        }
        
        .admin-details {
            background-color: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 30px;
        }
        
        .admin-detail-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid #e9ecef;
        }
        
        .admin-detail-item:last-child {
            border-bottom: none;
        }
        
        .admin-detail-item strong {
            color: #495057;
            font-weight: 500;
        }
        
        .admin-detail-item .value {
            background-color: white;
            padding: 4px 12px;
            border-radius: 4px;
            border: 1px solid #dee2e6;
            font-family: monospace;
            color: #667eea;
        }
        
        .notice {
            background-color: #fff3cd;
            color: #856404;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 30px;
            border: 1px solid #ffeaa7;
            text-align: left;
        }
        
        .notice h4 {
            margin-bottom: 10px;
        }
        
        .notice ul {
            margin-left: 20px;
        }
        
        .notice li {
            margin-bottom: 5px;
        }
        
        .button-group {
            display: flex;
            gap: 15px;
            justify-content: center;
        }
        
        .button {
            padding: 12px 30px;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-block;
            min-width: 120px;
        }
        
        .primary-button {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }
        
        .primary-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
        }
        
        .secondary-button {
            background-color: #6c757d;
            color: white;
        }
        
        .secondary-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
        }
        
        .footer {
            margin-top: 30px;
            color: #6c757d;
            font-size: 14px;
        }
        
        @media (max-width: 576px) {
            .container {
                padding: 30px 20px;
            }
            
            h1 {
                font-size: 24px;
            }
            
            .button-group {
                flex-direction: column;
            }
            
            .button {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="logo">
            <i class="fas fa-user-shield"></i>
        </div>
        
        <h1>安装完成！</h1>
        
        <div class="success-message">
            <p>系统已成功安装，以下是您的管理员账号信息：</p>
        </div>
        
        <img src="https://api.mmp.cc/api/qqavatar?qq=<?php echo $adminInfo['qq']; ?>" alt="管理员头像" class="admin-avatar">
        
        <div class="admin-details">
            <div class="admin-detail-item">
                <strong>管理员账号：</strong>
                <span class="value"><?php echo $adminInfo['username']; ?></span>
            </div>
            <div class="admin-detail-item">
                <strong>管理员密码：</strong>
                <span class="value"><?php echo $adminInfo['password']; ?></span>
            </div>
            <div class="admin-detail-item">
                <strong>管理员QQ：</strong>
                <span class="value"><?php echo $adminInfo['qq']; ?></span>
            </div>
        </div>
        
        <div class="notice">
            <h4>重要提示</h4>
            <ul>
                <li>请妥善保存此账号密码信息，刷新页面后将无法再次查看</li>
                <li>登录后台后请立即修改密码以确保安全</li>
                <li>定期备份数据库以防止数据丢失</li>
                <li>建议开启SSL证书以提高系统安全性</li>
            </ul>
        </div>

        <div class="countdown" style="
            background-color: #fff3cd;
            border: 1px solid #ffeaa7;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 30px;
            color: #856404;
            font-size: 16px;
        ">
            <p>此页面将在 <strong id="countdown-timer" style="
                color: #d63031;
                font-size: 24px;
                margin: 0 8px;
            ">15</strong> 秒后自动关闭，账号密码将不再显示</p>
        </div>
        
        <div class="button-group">
            <a href="../admin/admin_login.php" class="button primary-button">
                <i class="fas fa-lock mr-2"></i> 进入后台
            </a>
            <a href="../index.php" class="button secondary-button">
                <i class="fas fa-home mr-2"></i> 返回主页
            </a>
        </div>
        
        <div class="footer">
             © <?php echo date('Y'); ?> 订单自主查询系统
          </div>
    </div>
    
    <script>
        // 15秒倒计时
        let countdown = 15;
        const timerElement = document.getElementById('countdown-timer');
        
        const countdownInterval = setInterval(() => {
            countdown--;
            timerElement.textContent = countdown;
            
            if (countdown <= 0) {
                clearInterval(countdownInterval);
                
                // 倒计时结束后，执行清理操作
                window.open('delete_install_dir.php', '_blank');
                
                // 跳转到首页
                window.location.href = '../index.php';
            }
        }, 1000);
        
        // 防止页面刷新或后退
        window.addEventListener('beforeunload', function(e) {
            const confirmationMessage = '此页面关闭后将不再显示管理员账号密码信息，确定要离开吗？';
            (e || window.event).returnValue = confirmationMessage;
            return confirmationMessage;
        });
    </script>
</body>
</html>